import { defineStore } from 'pinia'
import request from '@/utils/request'
import {ApiRes, GoodsInfo} from '@/types/data'
export default defineStore('goods', {
    state() {
        return {
            // 商品详细信息
            goodsInfo: {}  as GoodsInfo
        }
    },
    getters : {},
    actions : {
        // 获取商品详情
    async getGoodsInfo(id : string) {
        const res = await request.get<ApiRes<GoodsInfo>>("/goods", {params:{id}})
        this.goodsInfo = res.data.result
    }}
})